/**
 * 
 */
package com.nars.exceptions.excersices;

import java.util.Date;

/**
 * @author Student
 * 
 */
public class Student {

	private int age;
	private Gender gender;
	private String name;
	private int classNumber;
	private int egn;
	private Date dateOfBirth;

	/**
	 * @return the age
	 */
	public int getAge() {
		return age;
	}

	/**
	 * @param age the age to set
	 */
	public void setAge(int age) {
		if (age > 18 || age < 7) {
			throw new IllegalArgumentException(
					"The age should be between 7 and 18");
		} else {
			this.age = age;
		}
	}

	/**
	 * @return the gender
	 */
	public Gender getGender() {
		return gender;
	}

	/**
	 * @param gender2 the gender to set
	 */
	public void setGender(Gender gender2) {
		if (gender2 == null){
			throw new IllegalArgumentException("The gender is either male or female");
		} else {
			this.gender = gender2;
		}
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		if (name.length() > 30 || name.length() < 10) {
			throw new IllegalArgumentException("The name should be between 10 and 30 characters");
		} else {
			this.name = name;
		}
	}

	/**
	 * @return the classNumber
	 */
	public int getClassNumber() {
		return classNumber;
	}

	/**
	 * @param classNumber the classNumber to set
	 */
	public void setClassNumber(int classNumber) {
		if (classNumber > 11 || classNumber < 1) {
			throw new IllegalArgumentException("The classNumber should be between 1 and 11");
		} else {
			this.classNumber = classNumber;
		}
	}

	/**
	 * @return the egn
	 */
	public int getEgn() {
		return egn;
	}

	/**
	 * @param egn the egn to set
	 */
	public void setEgn(int egn) {
		this.egn = egn;
	}

	/**
	 * @return the dateOfBirth
	 */
	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	/**
	 * @param dateOfBirth the dateOfBirth to set
	 */
	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	public Student(int age, Gender gender, String name, int classNumber) {
		setAge(age);
		setGender(gender);
		setName(name);
		setClassNumber(classNumber);
	}
	
	public static enum Gender {
		MALE, FEMALE;
	}
}
